package com.test.foreach;

import java.util.Arrays;
import java.util.List;

public class ForeachDemo {

    public static void main(String[] args) {
        List<String> strList = Arrays.asList(new String[]{"str1", "str2", "str3"});
        List<Integer> intList = Arrays.asList(new Integer[]{100, 200 , 300});

        strList.forEach(s -> {
            try {
                Thread.sleep(3 * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(s);
        });

        intList.forEach(integer -> System.out.println("int=" + integer));
    }
}
